package org.homly.pc.tag.scheme;

import java.util.HashMap;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.homly.service.SchemeService;
import org.homly.tool.StringTool;

/**
 * 查询方案详细
 */
@SuppressWarnings("serial")
public class SchemeDetailListTag extends TagSupport {

	private String name;
	private String schemeId;

	@Override
	public int doStartTag() throws JspException {

		List<HashMap<String, String>> schemeDetails = null;

		try {
			if (schemeId != null && StringTool.isNumber(schemeId)) {
				Integer schemeIdNum = Integer.valueOf(schemeId);
				schemeDetails = SchemeService.getSchemeDetailsBySchemeId(schemeIdNum);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		pageContext.setAttribute(name, schemeDetails);

		return SKIP_BODY;
	}

	public void setName(String name) {
		this.name = name;
	}
	public void setSchemeId(String schemeId) {
		this.schemeId = schemeId;
	}
}
